<template>
  <div id="app">
    <a-config-provider :locale="locale">
      <router-view />
    </a-config-provider>
  </div>
</template>
<script>
import zhCN from "ant-design-vue/lib/locale-provider/zh_CN";
import enGB from "ant-design-vue/lib/locale-provider/en_GB";
//vue.config.js设置了moment按需加载，此处需要手动引入，moment默认英文，只需要引入中文即可
import moment from "moment";
import "moment/locale/zh-cn";
import "moment/locale/en-gb";

export default {
  data() {
    return {
      locale: zhCN,
    };
  },
  watch: {
    "$route.query.locale": function (val) {
      this.locale = val == "enGB" ? enGB : zhCN;
      moment.locale(val == "enGB" ? "en" : "zh-cn");
    },
  },
};
</script>
<style lang="less"></style>
